﻿using System;
using System.Collections.Generic;
using System.Text;
using WPFCABShell.$safeprojectname$.Services.Command;

namespace WPFCABShell.$safeprojectname$.Services.ToolBar
{
	/// <summary>
	/// Provides services related to the application tool bar.
	/// </summary>
	/// <remarks>
	/// <para>
	/// The tool bar service can be used to manipulate application tool bars. Tool bars are automatically added and removed as necessary.
	/// Client code simply needs to use the add methods to add items and the <see cref="Remove"/> method to remove items.
	/// </para>
	/// <para>
	/// Like the menu service, the tool bar service supports grouping and sorting of tool bar items. Tool bar items with the same group
	/// index will appear together with separators on either side. The index is used within a group to sort tool bar items.
	/// </para>
	/// </remarks>
	public interface IToolBarService
	{
		/// <summary>
		/// Gets all site names for the tool bars managed by this tool bar service.
		/// </summary>
		IEnumerable<string> ToolBarSiteNames
		{
			get;
		}

		/// <summary>
		/// Occurs whenever a tool bar is added.
		/// </summary>
		event EventHandler<ToolBarEventArgs> ToolBarAdded;

		/// <summary>
		/// Occurs whenever a tool bar is removed.
		/// </summary>
		event EventHandler<ToolBarEventArgs> ToolBarRemoved;

		/// <summary>
		/// Occurs whenever a tool bar's visibility is modified.
		/// </summary>
		event EventHandler<ToolBarEventArgs> ToolBarVisibilityChanged;

		/// <summary>
		/// Adds a button item to a specified tool bar.
		/// </summary>
		/// <remarks>
		/// <para>
		/// If the specified tool bar does not exist, it is automatically created and added to the
		/// application's tool bars.
		/// </para>
		/// </remarks>
		/// <param name="toolBarSiteName">
		/// The name of the tool bar site to which the button item will be added.
		/// </param>
		/// <param name="command">
		/// The command for the tool bar item.
		/// </param>
		/// <param name="groupIndex">
		/// A group index, which allows related tool bar items to be grouped and automatically separated.
		/// </param>
		/// <param name="index">
		/// An index, which allows tool bar items in the same group to be ordered.
		/// </param>
		/// <returns></returns>
		IToolBarButtonItem AddButtonItem(string toolBarSiteName, ICommand command, int? groupIndex, int? index);

		/// <summary>
		/// Removes an item from the tool bar in which it resides.
		/// </summary>
		/// <param name="item">
		/// The tool bar item to be removed.
		/// </param>
		void Remove(IToolBarItem item);

		/// <summary>
		/// Gets a value indicating whether the specified tool bar is visible.
		/// </summary>
		/// <param name="toolBarSiteName">
		/// The tool bar site name.
		/// </param>
		/// <returns>
		/// <see langword="true"/> if the tool bar is visible, otherwise <see langword="false"/>.
		/// </returns>
		bool GetIsVisible(string toolBarSiteName);

		/// <summary>
		/// Sets the visibility of a specified tool bar.
		/// </summary>
		/// <param name="toolBarSiteName">
		/// The tool bar site name.
		/// </param>
		/// <param name="isVisible">
		/// <see langword="true"/> to show the tool bar, otherwise <see langword="false"/>.
		/// </param>
		void SetIsVisible(string toolBarSiteName, bool isVisible);
	}
}
